﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcApplication1.Models
{
    public class Cart
    {
        public OrderHeader Header { get; set; }
        public List<LineItem> Items { get; set; }
        public double Total
        {
            get { return Items.Sum(i => i.SubTotal); }
        }
    }

    public class Address
    {
        public string Street1 { get; set; }
        public string Street2 { get; set; }
        public string City { get; set; }
        public int Zip { get; set; }
        public string State { get; set; }
    }

    public class Product
    {
        public double Price { get; set; }
        public string Name { get; set; }
        public double Tax { get; set; }
        public double Cost { get; set; }
    }

    public class Account
    {
        public string Username { get; set; }
        public string Email { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }

    public class OrderHeader
    {
        public Account Account { get; set; }
        public Address Billing { get; set; }
        public Address Shipping { get; set; }
    }

public class LineItem
    {
        public Product Product { get; set; }
        public int Quantity { get; set; }
        public double SubTotal
        {
            get
            {
                return ((Product.Price * Product.Tax) + Product.Price) * Quantity;
            }
        }
    }
}